<h1 id="dhcrelay">dhcrelay</h1>
<p>使用dhcrelay命令可以提供中继DHCP和BOOTP请求</p>
<h2 id="补充说明">补充说明</h2>
<p><strong>dhcrelay命令</strong> 使用dhcrelay命令可以提供中继DHCP和BOOTP请求，从一个没有DHCP服务器的子网直接连接到其它子网内的一个或多个DHCP服务器。该命令在DHCP中继服务器上使用，同时支持DHCPv4/BOOTP和DHCPv6协议。</p>
<h3 id="语法">语法</h3>
<pre><code class="language-bash">dhcrelay [选项] [DHCP服务器]</code></pre>
<h3 id="选项">选项</h3>
<pre><code class="language-bash">-c &lt;跳数&gt; 当转发数据包时，dhcrelay丢弃已经达到一个最大跳数的数据包。默认值是10，最大值是255
-4 运行dhcrelay命令作为DHCPv4/BOOTP中继代理。这是默认操作模式
-6 运行dhcrelay命令作为DHCPv6中继代理
-q 安静模式
-p &lt;端口&gt; 监听和发送端口。DHCPv4/BOOTP默认端口是67，DHCPv6默认端口是547
-A &lt;长度&gt; 指定发送到DHCP服务器的最大数据包大小
-d 强制dhcrelay命令作为前台进程运行</code></pre>
<h3 id="例子">例子</h3>
<p>指定DHCP服务器的位置。</p>
<div class="sourceCode" id="cb3"><pre><code class="language-bash"><a class="sourceLine" id="cb3-1" data-line-number="1">[<span class="ex">root@localhost</span> ~]# dhcrelay 192.168.0.2</a>
<a class="sourceLine" id="cb3-2" data-line-number="2"><span class="ex">Internet</span> Systems Consortium DHCP Relay Agent4.1.1-P1</a>
<a class="sourceLine" id="cb3-3" data-line-number="3"><span class="ex">Copyright</span> 2004-2010 Internet SystemsConsortium.</a>
<a class="sourceLine" id="cb3-4" data-line-number="4"><span class="ex">All</span> rights reserved.</a>
<a class="sourceLine" id="cb3-5" data-line-number="5"><span class="ex">For</span> info, please visithttps://www.isc.org/software/dhcp/</a>
<a class="sourceLine" id="cb3-6" data-line-number="6"><span class="ex">Listening</span> on LPF/eth1/00:0c:29:fc:2f:ef</a>
<a class="sourceLine" id="cb3-7" data-line-number="7"><span class="ex">Sending</span> on  LPF/eth1/00:0c:29:fc:2f:ef</a>
<a class="sourceLine" id="cb3-8" data-line-number="8"><span class="ex">Listening</span> on LPF/eth0/00:0c:27:fc:25:ec</a>
<a class="sourceLine" id="cb3-9" data-line-number="9"><span class="ex">Sending</span> on  LPF/eth0/00:0c:27:fc:25:ec</a>
<a class="sourceLine" id="cb3-10" data-line-number="10"><span class="ex">Sending</span> on  Socket/fallback</a></code></pre></div>
<!-- Linux命令行搜索引擎：https://jaywcjlove.github.io/linux-command/ -->
